<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 240px;
            height: 360px;
            margin: 200px auto;
            border: 3px red solid ;
            /* 裁剪溢出的部分 */
            overflow: hidden;
        }
        .box img{
            width: 100%;
            /* 设置变形时间 */
            transition: 2s;
        }
        .box:hover img{
            /* 缩小 */
            transform: scale(.8);
            /* 放大 */
            transform: scale(1.2);
        }
    </style>
</head>
<body>
    <div class="box">
        <img src="./img.jpg" alt="">
    </div>
</body>
</html>